<?php
class ExhibitionModel extends BaseModel implements Model {
    function __construct() {
        parent::__construct("exhibition", "id");
        $this->addField("id", Model::TYPE_INT, Model::MOD_PRIMARY);
        $this->addField("exhibition_name", Model::TYPE_TEXT);
        $this->addField("startdate", Model::TYPE_DATE);
        $this->addField("enddate", Model::TYPE_DATE);
    }

    public function getCurrentExhibition() {
        $today = date("Y-m-d");
        $result = $this->loadAll("startdate <= '$today' and enddate >= '$today'");
        return $result[0];
    }

    public function renderAlias($record) {
        $result = $record;
        return $result;
    }

    public function isAuthorized($operation, $subject = "") {
        return true;
    }

    public function modifyDatabaseInput($data) {
        return $data;
    }
}

?>
